import { createRouter, createWebHistory } from 'vue-router';
import Home from '../views/Home.vue';
import RestaurantDetail from '../views/RestaurantDetail.vue';
import UserProfile from '../views/UserProfile.vue';

const routes = [
    {
        path: '/',
        name: 'home',
        component: Home,
    },
    {
        path: '/restaurant/:id',  // 动态路由接收餐厅ID
        name: 'restaurant',
        component: RestaurantDetail,
        props: true,  // 将路由参数传递给组件作为props
    },
    {
        path: '/user',
        name: 'user',
        component: UserProfile,
    },
];

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes,
});

export default router;
